import {ref,reactive} from 'vue'
import {defineStore} from 'pinia'
import { residentInfoListGet, residentInfoPageGet} from '@/api/residentInfoApi.js';

export const useResidentInfoStore = defineStore('residentInfo', () => {

const residentInfoPage = ref([])
const residentInfoList = ref([])
const pagination = reactive({
    current:1,
    total:0
})

async function getResidentInfoPage(query = {}) {
let {records, current, total} =await residentInfoPageGet(query)
residentInfoPage.value = records
pagination.current = current
pagination.total = total
}

async function getResidentInfoList(query = {}) {
residentInfoList.value = await residentInfoListGet(query)
}


return {
pagination,
residentInfoPage, getResidentInfoPage,getResidentInfoList}
})
